<?php
	namespace Home\Controller;
	use Think\Controller;
	class ListController extends Controller{
		public function index(){
            //---
            $username = session('user');
            $this->assign('username',$username['username']);
             //---实例化type表
            $type_list = D('type');
            $str = $type_list->list_type();
            $this->assign('glist',$str['glist']);
            //分配面包屑数据
            $this->assign('com',$str['str']);
            $this->assign('list',$str['list']);
            //分页按钮
            $this->assign('show',$str['show']);
            // dump($str['glist']);
            // dump($str['glist']);
            //查询子类
            $list_son = $type_list->type_son();
            $this->assign('list_son',$list_son);
            //实例化goods表--猜你喜欢
            $goods_ = D('goods');
            $like = $goods_->goods_like();  
            $this->assign('like',$like);
             //调用分类列表
            $this->type_secl();
            //调用友情链接
            $this->link_s();
            //调用导航栏
            $this->bar();
			$this->display(); 
		}
           //首页分类查询方法
            public function type_secl(){
               $type = D('type');
               $t_list = $type->type_sec();
               $this->assign('t_list',$t_list);
            }
            //首页友链查询方法
            public function link_s(){
                $links = D('links');
                $link = $links->links_sec();
                // dump($list);
                $this->assign('link',$link);
            }
            //输出导航栏
            public function bar(){
                $type = D('type');
                $t_bar = $type->bar_sec();
                $this->assign('bar',$t_bar);
            }
        //==20170124===实现搜索功能==========================================
            public function seach()
            {
                $user = D('goods');
                $list = $user->seach_goods();
                $username = session('user');
                $this->assign('username',$username['username']);
                   //调用分类列表
                $this->type_secl();
                //调用友情链接
                $this->link_s();
                //调用导航栏
                $this->bar();
                $goods_ = D('goods');
                $like = $goods_->goods_like();  
                $this->assign('like',$like);

                $this->assign('glist',$list['glist']);
                $this->assign('show',$list['show']);
                $this->display('index');
            }
	}